package edu.mit.compilers.lowercode.code;

public abstract class ThreeAddressCode {
    public final static int PREFIX_LIMIT = 10;
    private String label;

    private boolean isNeedLabel = false;

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public boolean hasLabel() {
        return label != null;
    }


    protected abstract String getStringFroShow(String prefix);

    public void getStringForShow(String prefix, StringBuilder ret) {
        ret.append(getStringFroShow(prefix)).append('\n');
    }

    public void setNeedLabelTrue() {
        isNeedLabel = true;
    }

    public boolean isNeedLabel() {
        return isNeedLabel;
    }

    public abstract <T> T accept(ThreadAddressCodeVistor<T> visitor);
}
